package com.china08.yxyapi.repository.db;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.china08.yxyapi.entity.db.sws.SwsSettingLinks;

public interface SwsSettingLinksRepository extends JpaRepository<SwsSettingLinks, String> {

    List<SwsSettingLinks> findBySchoolIdOrderByOrderNumAsc(String schoolId);

    @Modifying
    @Transactional
    Long deleteById(String id);

    SwsSettingLinks findById(String id);

    @Query(" select count(id) from SwsSettingLinks where (schoolId = ?1) and (linkName = ?2 or linkUrl = ?3)")
    long countBySchoolIdAndLinkName(String schoolId, String linkName, String linkUrl);

}
